﻿using System.Linq;
using Analyze.Provider;
using Common.Dao;
using log4net;

namespace Analyze.Script
{
    public class ModelSimplifyScript
    {
        private static readonly ILog Log = LogManager.GetLogger(typeof(ModelSimplifyScript));
        
        public static void Run()
        {
            Log.Info("ModelSimplifyScript start");
            var eventsWithWords = DxwEventDao.GetEventsWithWords();
            var blockList = eventsWithWords.Select(m=>m.Block).Distinct().ToList();
            var models = ClassifyModelDao.GetClassifyModel();

            models.Where(m=>m.WordConditionaProbability<0.005).ToList().ForEach(m =>
            {
                Log.Info("Block = " + m.Block);
                Log.Info("Word = " + m.Word);
                Log.Info("WordConditionaProbability = " + m.WordConditionaProbability);
                Log.Info("===============================================");
            });
            TrainingDataProvider.GetInstance().Reload();
            Log.Info("ModelSimplifyScript end");
        }
    }
}